<?php

class All extends TPage
{
	public $payment_manager;
	public $count;
	
	public function onLoad($params)
	{
		parent::onLoad($params);
		
		$this->payment_manager = $this->Application->Modules['payments'];
		$page = $this->Application->Request['site'];
		$this->count = $this->payment_manager->countPayments();
		
		$this->site_manager->setData(	$this->Page->getPagePath(),
										array(),
										$page,
										$this->count,
										10);
			
		$this->PaymentList->DataSource = $this->payment_manager->getPaymentsList(
													true,
													$this->site_manager->getOffset(),
													$this->site_manager->getElementsPerSite());
		$this->PaymentList->dataBind();
	}
	
	public function deleteButtonClicked($sender, $param)
	{
		$this->payment_manager->deletePayment($param->CommandParameter);
		$this->Application->Response->reload();
	}
	
	public function editButtonClicked($sender, $param)
	{
		$this->Response->redirect(
			$this->Service->constructUrl(	'organizer.payments.Edit',
											array('id' => $param->CommandParameter)));
	}
	
	public function getCurrencyName()
	{
		$setting_manager = $this->Application->Modules['settings'];
		if($setting = $setting_manager->getSettingByName(SettingManager::$CURRENCY_NAME))
			return $setting->getValue() != '' ? $setting->getValue() : '-';
		return '-';
	}
}

?>